package com.cs.study.homework._0224;

import java.awt.*;

public class Demo {
    int aaa = 1;
    private int bbb = 2;
    static int ccc = 3;

    public static void main(String[] args) {
        System.out.println(new Outer().a);
//        System.out.println(new Outer().b);
        System.out.println(new Outer().c);

    }
}

class Outer {
    int a = 1;
    private int b = 2;
    static int c = 3;

    public void getInner() {
        System.out.println(new Inner().aa);
        System.out.println(new Inner().bb);
        System.out.println(new Inner().cc);
    }

    public void getDemo() {
        System.out.println(new Demo().aaa);
        //System.out.println(new Demo().bbb);
    }

    class Inner {
        int aa = 1;
        private int bb = 2;
        static int cc = 3;

        public void getOuter() {
            System.out.println(a);
            System.out.println(b);
            System.out.println(c);
        }

        public void getInner2() {
            Inner2 inner2 = new Inner2();
            System.out.println(inner2.aa2);
            System.out.println(inner2.bb2);
            System.out.println(inner2.cc2);
        }
    }

    class Inner2 {
        int aa2 = 1;
        private int bb2 = 2;
        static int cc2 = 3;

        //静态内部类访问外部其他类
        public void getDemo() {
            System.out.println(new Demo().aaa);
//            System.out.println(new Demo().bbb);
            System.out.println(new Demo().ccc);
        }

        //静态内部类访问外部类
        public void getOuter() {
            System.out.println(new Outer().a);
            System.out.println(new Outer().b);
            System.out.println(new Outer().c);
        }

        public void getIInner() {
            Inner inner = new Inner();
            System.out.println(inner.aa);
            System.out.println(inner.bb);
            System.out.println(inner.cc);
        }
    }
}
